package com.czl.module_work.adapter

import com.blankj.utilcode.util.ColorUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.czl.module_work.R
import com.czl.module_work.databinding.WorkItemInviteTypeBinding

class InviteTypeAdapter :
    BaseQuickAdapter<String, BaseDataBindingHolder<WorkItemInviteTypeBinding>>(R.layout.work_item_invite_type) {

    var selectIndex = 0
    var oldIndex = 0

    override fun convert(holder: BaseDataBindingHolder<WorkItemInviteTypeBinding>, item: String) {
        holder.dataBinding?.apply {
            content = item
        }

        holder.setBackgroundResource(
            R.id.item_tv_name, if (selectIndex == holder.bindingAdapterPosition) {

                R.color.work_color_ff3ecc98
            } else {
                R.color.white
            }
        ).setTextColor(
            R.id.item_tv_name, if (selectIndex == holder.bindingAdapterPosition) {
                ColorUtils.getColor(R.color.white)
            } else {
                ColorUtils.getColor(R.color.work_color_00A468)
            }
        )
    }
}